import styles from './index.module.scss'
function EditList({ type, onClose, onSubmit, onFile }) {
    const config = {
        photo: [{
            title: '拍照',
            onClick: () => {
                console.log('拍照');
            }
        }, {
            title: '上传',
            onClick: () => {
                onFile()
            }
        }],
        gender: [{
            title: '男',
            onClick: () => {
                onSubmit('gender', 0)
            }
        }, {
            title: '女',
            onClick: () => {
                onSubmit('gender', 1)
            }
        }]
    }
    const list = config[type] || []
    return (
        <div className={styles.root}>
            {/* 列表项 */}
            {list.map(item => {
                return <div className="list-item" key={item.title} onClick={() => item.onClick()}>{item.title}</div>
            })}

            {/* 取消按钮 */}
            <div className="list-item" onClick={() => onClose()}>取消</div>
        </div>
    )
}

export default EditList